<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $cfg_soft_lang; ?>" />
    <title><?php echo $diy->name;?></title>
    <link href="css/base.css" rel="stylesheet" type="text/css" />
    <?php $colspanNum = count($fieldlist) + 2; ?>
    <style>
        .data-list-item:nth-child(even) {
            background: #ffffffcc;
        }
        .data-list-item:hover {
          transition: all 0s;
          background: rgba(255, 255, 255, 0.6);
        }
        .pagelistbox {
            width: 100%;
            height: 50px;
            margin: 0 auto;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .pagelistbox span {
            color: #666;
            font-family: Microsoft Yahei;
            font-size: 15px;
            display: block;
            float: left;
            margin-top: 7px;
        }
        .pagelistbox .indexPage {
            display: block;
            float: left;
            background: #009688;
            color: #fff;
            font-size: 15px;
            font-family: Microsoft Yahei;
            line-height: 25px;
            border: 1px solid #b4b4b4;
            border-radius: 3px;
            margin: 0 0 0 20px;
            padding: 0px 10px 0px 10px;
        }
        .pagelistbox .indexPage:hover {
            background: #16b6a7;
        }
        .pagelistbox strong,
        .pagelistbox .endPage {
            display: block;
            float: left;
            background: #009688;
            color: #fff;
            font-size: 15px;
            font-family: Microsoft Yahei;
            line-height: 25px;
            border: 1px solid #b4b4b4;
            border-radius: 3px;
            margin-left: 5px;
            padding: 0px 10px 0px 10px;
        }
        .pagelistbox strong:hover {
            background: #16b6a7;
        }
        .pagelistbox .endPage:hover {
            background: #16b6a7;
        }
        .pagelistbox .prePage,
        .pagelistbox .nextPage,
        .pagelistbox a {
            display: block;
            float: left;
            background: #fff;
            color: #009688;
            font-size: 15px;
            font-family: Microsoft Yahei;
            line-height: 25px;
            border: 1px solid #b4b4b4;
            border-radius: 3px;
            margin-left: 5px;
            padding: 0px 10px 0px 10px;
        }
    </style>
</head>
<body background='images/allbg.gif'>
    <div class="bodytitle">
        <div class="bodytitleleft"></div>
        <div class="bodytitletxt" style="padding-left:10px;"><?php echo $diy->name;?>内容列表</div>
    </div>

    <form action="diy_list.php" method="post">

        <input type="hidden" name="diyid" value="<?php echo $diyid;?>" />
        <table width="100%" border="0" cellpadding="1" cellspacing="1" align="center" class="tbtitle" style="background:#CFCFCF;">
            <tr>
                <td colspan="<?php echo($colspanNum); ?>" height="28" background='images/tbg.gif'>
                    <div style='float:left'>
                        <span>&nbsp;</span>
                        <a href='diy_main.php'>
                            <b>自定义表单管理</b>
                        </a>
                        <span>&gt;</span>
                        <b>内容列表</b>
                    </div>
                    <div style='float:right;padding-right:8px;'>
                        <a href="../plus/diy.php?action=list&diyid=<?php echo $diy->diyid; ?>" target="_blank">
                            <img src='images/gtk-tmp.png' align='left' title='预览' alt='预览' />
                            <u>前台预览</u>
                        </a>
                    </div>
                </td>
            </tr>
            <tr class="table-header" background='images/tbg.gif'>
            <?php
                echo '<td width="5%"><input type="checkbox" class="select-btn-item" onclick="selectAll(this)" />ID</td><td width="10%">跟进状态</td>';
                foreach($fieldlist as $key => $item)
                {
                    echo '<td>'.$item[0].'</td>';
                }
            ?>
            </tr>
            {dede:datalist pagesize='2000'}
            <?php

                if(!empty($fields)) {
                    $allowhtml = array('htmltext');
                    $fields['sta'] = $fields['ifcheck'] == 1 ? '已跟进' : '未跟进';
                    echo '<tr bgcolor="#fff" class="data-list-item"><td width="5%" style="text-align:left"><input type="checkbox" name="id[]" value="'.$fields['id'].'" class="np" /><a href="diy_list.php?action=edit&diyid='.$diy->diyid.'&id='.$fields['id'].'">'.$fields['id'].'</a></td><td width="10%">'.$fields['sta'].'</td>';
                    foreach($fieldlist as $field=>$fielddata) {
                        if($fielddata[1]=='img') {
                            $fields[$field] = "<a href='{$fields[$field]}' target='_blank'><img src='images/channeladd.gif' border='0' /> 图片附件</a>\r\n";
                        } else if($fielddata[1]=='addon') {
                            $fields[$field] = "<a href='{$fields[$field]}' target='_blank'><img src='images/channeladd.gif' border='0' /> 其它附件</a>";
                        } else {
                            if(!in_array($fielddata[1],$allowhtml)) {
                                $fields[$field] = htmlspecialchars($fields[$field]);
                            }
                        }
                        echo '<td>'.$fields[$field].'</td>';
                    }

                } else {
                    echo "<tr><td bgcolor='#ffffff'>暂无记录</td></tr>";
                }
            ?>
            {/dede:datalist}
            <tr>
                <td colspan="<?php echo($colspanNum); ?>" bgcolor="#ffffff">{dede:pagelist listsize=5 /}</td>
            </tr>
            <tr>
                <td colspan="<?php echo($colspanNum); ?>" height='36' align="center" bgcolor="#F8FCF1">
                    <label>
                        <input type="radio" name="action" value="check" class='np' />
                        跟进
                    </label>
                    <label>
                        <input type="radio" name="action" value="delete"  class='np' />
                        删除
                    </label>
                    <span>&nbsp;&nbsp;</span>
                    <input type="submit" name="submit" value="提交" class='np coolbg' />
                </td>
            </tr>
        </table>
    </form>
    <script>
        function selectAll(e) {
            e.checked = !e.checked;
            var a = document.getElementsByTagName("input");
            for (var i = 0; i < a.length; i++) {
                if (a[i].type == "checkbox") a[i].checked = !a[i].checked;
            }
        }
  </script>
</body>
</html>